


//暂无数据
export function noData() {
  wx.showToast({
    title: '暂无数据',
    icon: 'none',
    duration: 2000
  })
}

export function tips(data){
  wx.showToast({
    title: data,
    con: 'none',
    duration: 2000
  })
}

/**
 * 用户模态框
 * smg:消息提示
 * cancel:是否要取消按钮
 * fonfirm:成功方法的回调
 * cancelFun:失败方法的回调
 */
export function operation(msg, cancel, btnText,
confirm = function(){}, cancelFun = function(){}) {
  wx.showModal({
    title: '提示',
    content: msg,
    confirmText: btnText || '确定',
    cancelColor:'#E50215',
    confirmColor:'#E50215',
    showCancel: cancel||false,
    success: function (res) {
      if (res.confirm) {
       confirm()//这里是点击了确定以后
      } else {
        cancelFun()//这里是点击了取消以后
      }
    }
  })
}


//重新登录
export function reLogin() {
  wx.showModal({
    title: "提示",
    content: '重新登录',
    showCancel: false,
    confirmText: "返回首页",
    success(res) {
      if (res.confirm)
        wx.redirectTo({
          url: '/pages/login/login',//关闭所有页面 重新登录
        })
    }
  })
}

